﻿using Microsoft.AspNetCore.Mvc;
using PMS.Web.Framework.Components;

namespace PMS.Plugin.ExternalAuth.DingTalkScan.Components
{
    /// <summary>
    /// Represents view component to display login button
    /// </summary>
    [ViewComponent(Name = DingTalkScanAuthenticationDefaults.VIEW_COMPONENT_NAME)]
    public class DingTalkScanAuthenticationViewComponent : PMSViewComponent
    {
        /// <summary>
        /// Invoke view component
        /// </summary>
        /// <param name="widgetZone">Widget zone name</param>
        /// <param name="additionalData">Additional data</param>
        /// <returns>View component result</returns>
        public IViewComponentResult Invoke(string widgetZone, object additionalData)
        {
            if(string.IsNullOrEmpty(widgetZone))
            {
                widgetZone = "Login";
            }
            return View("~/Plugins/ExternalAuth.DingTalkScan/Views/PublicInfo.cshtml", widgetZone);
        }
    }

}
